import { reqUserTrade, reqOrderInfo } from '@/api'
const state = {
    address: [],
    orderInfo: {}
}
const actions = {
    // 获取用户地址信息
    async getUserAddress ({ commit }) {
        let res = await reqUserTrade();
        if (res.code == 200) {
            commit('GETUSERADDRESS', res.data)
        }
    },
    // 获取商品清单
    async getOrderInfo ({ commit }) {
        let res = await reqOrderInfo();
        if (res.code == 200) {
            commit('GETORDERINFO', res.data)
        }
    }
}

const mutations = {
    GETUSERADDRESS (state, address) {
        state.address = address
    },
    GETORDERINFO (state, orderInfo) {
        state.orderInfo = orderInfo
    }
}
const getters = {}

export default {
    state, actions, mutations, getters
}